###windows下的源码下载
####创建目录
新建目录 aosp,cd到目录下
然后 通过 git克隆以下镜像,这会在目录下创建manifest目录
git clone https://android.googlesource.com/platform/manifest.git
//没有梯子使用清华源
git clone https://aosp.tuna.tsinghua.edu.cn/platform/manifest.git
cd到manifest目录中,通过git branch -a查看分支版本
找到想要下载的分支版本进行下载,如
git checkout android-6.0.1_r79
最后通过以下python脚本进行下载
1 | import xml.dom.minidom |
###Android源码的下载
####下载repo并配置repo
1 | sudo apt-get install git-core curl |
####创建源码路径
1 | mkdir aosp |
####下载
执行init
repo init -u https://android.googlesource.com/platform/manifest
这样下载的是master的代码,如果要指定某个版本,可以通过
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-4.4.4_r1
如果提示无法连接到 gerrit.googlesource.com,可以编辑 ~/bin/repo,把 REPO_URL 一行替换成
REPO_URL = ‘https://mirrors.tuna.tsinghua.edu.cn/git/git-repo’
然后下载通过
repo sync
####JDK的配置
编译KK(android4.4)需要jdk的版本是1.6,注意这里的jdk为oracle,不能是openjdk,
1 | sudo mkdir /usr/local/jdk #jdk的安装路径 |
make降级
在ubuntu16.04上的make版本默认是4.1,但编译kk需要的版本为3.81或者3.82,所以需要下载安装make-3.82
1 | tar -xjvf make-3.81.tar.bz2 |
####编译源码
1 | source build/envsetup.sh |
###下载及编译kernel
####kernel下载
1 | lisc@lisc-ubuntu:/home/aosp/android-4.4$ mkdir kernel |
####编译环境的配置
1 | lisc@lisc-ubuntu:/home/aosp/android-4.4/kernel/goldfish$ export ARCH=arm |
将交叉编译工具设置到PATH中
lisc@lisc-ubuntu:/home/aosp/android-4.4/kernel/goldfish$ export PATH=$PATH:/home/aosp/android-4.4/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin
####编译kernel
1 | lisc@lisc-ubuntu:/home/aosp/android-4.4/kernel/goldfish$ make goldfish_armv7_defconfig |